#!/usr/bin/env python3
# coding:utf-8
#lanxing

#判断代码，判断是否安装requests库
try:
    import requests
except:
    print(u"返回桌面,Shift+鼠标右键,在此处打开命令窗口(W),输入:pip install requests")
import zlib
import json


def whatweb(url):
    response = requests.get(url, verify=False)
    # 上面的代码可以随意发挥,只要获取到response即可
    # 下面的代码您无需改变，直接使用即可
    whatweb_dict = {"url": response.url, "text": response.text, "headers": dict(response.headers)}
    whatweb_dict = json.dumps(whatweb_dict)
    whatweb_dict = whatweb_dict.encode()
    whatweb_dict = zlib.compress(whatweb_dict)
    data = {"info": whatweb_dict}
    return requests.post("http://whatweb.bugscaner.com/api.go", files=data).json()
a = 'http://www.sh-bokecc.cn/'
a1 = str(a)
request = whatweb(a)
# result = list(request)
print(request)
# print(result)
# return render(request, 'info/web_ident.html', {'result': result})

# if request.method == 'POST':
#     target = request.POST.get('arg')
#     a = str(target)
#

# http://www.sh-bokecc.cn/
# http://www.dedecms.com/
# http://www.mapintime.com/
# https://www.siteserver.cn/
# http://www.jnbec.com/
# https://www.joyboom.com/shouye/